package com.iqiyi.pps.epg.core.model.program;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by karkarrotxu on 2015/8/19.
 */
public class ProgramCheckListData {
    public static final String WARN_ASPECT_RATIO = "4:3";
    private boolean hasError;
    private String checkErrorMsg;

    private String channelName;
    private boolean channelAllowPopUps;
    private long channelQitanId;
    private boolean channelQiTanShow;

    private boolean enable;
    private String subjectUrl;

    private String defaultLogoUrl;
    private long channelQipuId;
    private long channelOldQipuId;

    private String programName;
    private String startTime;
    private String endTime;
    private boolean programAllowPopUps;
    private String programBoss;
    private long programQipuId;
    private String programTag;

    //    伪播放地址
    private String pageUrl;
    //8080 端口访问状态
    private String vrsVisitResult;
    private boolean vrsVisitRed;

    private boolean platformEmpty = false;
    private boolean programPlatformEmpty = false;

    private String programDefaultLogoUrl;

    // 节目 聊天室
    private boolean chatEnable;
    private boolean chatDisplay;
    private long chatRoomId;

    // 道具
    private boolean daojuEnable;
    private String daojuId;

    //节目评论
    private long programQitanId;
    private boolean programQiTanShow;

    private String episodeGrade;

    private String maxLogTime = null;

    private String cqisuUrl = null;
    private String pqisuUrl = null;

    private String vrsVipUrl = null;

    private String vrsNormalUrl = null;

    private String vrsFirstResult = null;
    private String vrsFirstUrl = null;

    private List<String> onlinePlatforms = new ArrayList<String>();

    private List<String> programOnlinePlatforms = new ArrayList<String>();

    private Map<String, LinkData> streamMap = new HashMap<String, LinkData>();

    private List<ChannelStreamData> channelStreamDataList = new ArrayList<ChannelStreamData>();

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public boolean isChannelAllowPopUps() {
        return channelAllowPopUps;
    }

    public void setChannelAllowPopUps(boolean channelAllowPopUps) {
        this.channelAllowPopUps = channelAllowPopUps;
    }

    public long getChannelQitanId() {
        return channelQitanId;
    }

    public void setChannelQitanId(long channelQitanId) {
        this.channelQitanId = channelQitanId;
    }

    public boolean isChannelQiTanShow() {
        return channelQiTanShow;
    }

    public void setChannelQiTanShow(boolean channelQiTanShow) {
        this.channelQiTanShow = channelQiTanShow;
    }


    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public String getDefaultLogoUrl() {
        return defaultLogoUrl;
    }

    public void setDefaultLogoUrl(String defaultLogoUrl) {
        this.defaultLogoUrl = defaultLogoUrl;
    }

    public long getChannelQipuId() {
        return channelQipuId;
    }

    public void setChannelQipuId(long channelQipuId) {
        this.channelQipuId = channelQipuId;
    }

    public long getChannelOldQipuId() {
        return channelOldQipuId;
    }

    public void setChannelOldQipuId(long channelOldQipuId) {
        this.channelOldQipuId = channelOldQipuId;
    }

    public String getProgramName() {
        return programName;
    }

    public void setProgramName(String programName) {
        this.programName = programName;
    }

    public String getStartTime() {
        return startTime;
    }

    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }

    public String getEndTime() {
        return endTime;
    }

    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

    public boolean isProgramAllowPopUps() {
        return programAllowPopUps;
    }

    public void setProgramAllowPopUps(boolean programAllowPopUps) {
        this.programAllowPopUps = programAllowPopUps;
    }

    public String getProgramBoss() {
        return programBoss;
    }

    public void setProgramBoss(String programBoss) {
        this.programBoss = programBoss;
    }

    public String getPageUrl() {
        return pageUrl;
    }

    public void setPageUrl(String pageUrl) {
        this.pageUrl = pageUrl;
    }

    public String getVrsVisitResult() {
        return vrsVisitResult;
    }

    public void setVrsVisitResult(String vrsVisitResult) {
        this.vrsVisitResult = vrsVisitResult;
    }

    public List<String> getOnlinePlatforms() {
        return onlinePlatforms;
    }

    public void addOnlinePlatform(String platformName) {
        onlinePlatforms.add(platformName);
    }

    public List<String> getProgramOnlinePlatforms() {
        return programOnlinePlatforms;
    }

    public void addProgramOnlinePlatform(String platformName) {
        programOnlinePlatforms.add(platformName);
    }

    public void setStreamMap(Map<String, LinkData> map) {
        this.streamMap = map;
    }

    public Map<String, LinkData> getStreamMap() {
        return streamMap;
    }

    public List<ChannelStreamData> getChannelStreamDataList() {
        return channelStreamDataList;
    }

    public void setChannelStreamDataList(List<ChannelStreamData> channelStreamDataList) {
        if (channelStreamDataList != null) {
            this.channelStreamDataList = channelStreamDataList;
        }

    }

    public boolean isVrsVisitRed() {
        return vrsVisitRed;
    }

    public void setVrsVisitRed(boolean vrsVisitRed) {
        this.vrsVisitRed = vrsVisitRed;
    }

    public boolean isHasError() {
        return hasError;
    }

    public void setHasError(boolean hasError) {
        this.hasError = hasError;
    }

    public void setCheckErrorMsg(String checkErrorMsg) {
        this.checkErrorMsg = checkErrorMsg;
    }

    public String getCheckErrorMsg() {
        return checkErrorMsg;
    }

    public String getSubjectUrl() {
        return subjectUrl;
    }

    public void setSubjectUrl(String subjectUrl) {
        this.subjectUrl = subjectUrl;
    }

    public long getProgramQipuId() {
        return programQipuId;
    }

    public void setProgramQipuId(long programQipuId) {
        this.programQipuId = programQipuId;
    }

    public boolean isPlatformEmpty() {
        return platformEmpty;
    }

    public void setPlatformEmpty(boolean platformEmpty) {
        this.platformEmpty = platformEmpty;
    }

    public boolean isProgramPlatformEmpty() {
        return programPlatformEmpty;
    }

    public void setProgramPlatformEmpty(boolean programPlatformEmpty) {
        this.programPlatformEmpty = programPlatformEmpty;
    }

    public String getProgramDefaultLogoUrl() {
        return programDefaultLogoUrl;
    }

    public void setProgramDefaultLogoUrl(String programDefaultLogoUrl) {
        this.programDefaultLogoUrl = programDefaultLogoUrl;
    }

    public boolean isChatEnable() {
        return chatEnable;
    }

    public void setChatEnable(boolean chatEnable) {
        this.chatEnable = chatEnable;
    }

    public boolean isChatDisplay() {
        return chatDisplay;
    }

    public void setChatDisplay(boolean chatDisplay) {
        this.chatDisplay = chatDisplay;
    }

    public long getChatRoomId() {
        return chatRoomId;
    }

    public void setChatRoomId(long chatRoomId) {
        this.chatRoomId = chatRoomId;
    }

    public boolean isDaojuEnable() {
        return daojuEnable;
    }

    public void setDaojuEnable(boolean daojuEnable) {
        this.daojuEnable = daojuEnable;
    }

    public String getDaojuId() {
        return daojuId;
    }

    public void setDaojuId(String daojuId) {
        this.daojuId = daojuId;
    }

    public long getProgramQitanId() {
        return programQitanId;
    }

    public void setProgramQitanId(long programQitanId) {
        this.programQitanId = programQitanId;
    }

    public boolean isProgramQiTanShow() {
        return programQiTanShow;
    }

    public void setProgramQiTanShow(boolean programQiTanShow) {
        this.programQiTanShow = programQiTanShow;
    }

    public String getEpisodeGrade() {
        return episodeGrade;
    }

    public void setEpisodeGrade(String episodeGrade) {
        this.episodeGrade = episodeGrade;
    }

    public boolean hasSpanWarn() {
        for (LinkData linkData : streamMap.values()) {
            if (linkData.isSpanWarn()) {
                return true;
            }
        }
        return false;
    }

    public boolean hasEncodeRed() {
        for (ChannelStreamData checkData : channelStreamDataList) {
            if (checkData.isEncodeRed()) {
                return true;
            }
        }
        return false;
    }

    public int getStreamLogWarn() {
        int ret = -1;
        String maxLogTime = getStartTime();
        for (ChannelStreamData checkData : channelStreamDataList) {
            if (checkData.getLogTime() != null && maxLogTime.compareTo(checkData.getLogTime()) < 0) {
                maxLogTime = checkData.getLogTime();
                ret = checkData.getLogType();
            }
        }
        if(ret != -1 ){
            this.maxLogTime = maxLogTime;
        }
        return ret;
    }

    public boolean getStreamAspectRatioWarn(){
        for (ChannelStreamData checkData : channelStreamDataList) {
            if (WARN_ASPECT_RATIO.equals(checkData.getStreamAspectRatio()) ) {
             return true;
            }
        }
        return false;
    }

    public String getMaxLogTime() {
        return maxLogTime;
    }

    public String getPqisuUrl() {
        return pqisuUrl;
    }

    public void setPqisuUrl(String pqisuUrl) {
        this.pqisuUrl = pqisuUrl;
    }

    public String getCqisuUrl() {
        return cqisuUrl;
    }

    public void setCqisuUrl(String cqisuUrl) {
        this.cqisuUrl = cqisuUrl;
    }

    public String getVrsVipUrl() {
        return vrsVipUrl;
    }

    public void setVrsVipUrl(String vrsVipUrl) {
        this.vrsVipUrl = vrsVipUrl;
    }

    public boolean isFree() {
        return ProgramData.FREE.equals(this.programBoss);
    }

    public String getVrsNormalUrl() {
        return vrsNormalUrl;
    }

    public void setVrsNormalUrl(String vrsNormalUrl) {
        this.vrsNormalUrl = vrsNormalUrl;
    }

    public String getVrsFirstResult() {
        return vrsFirstResult;
    }

    public void setVrsFirstResult(String vrsFirstResult) {
        this.vrsFirstResult = vrsFirstResult;
    }

    public String getVrsFirstUrl() {
        return vrsFirstUrl;
    }

    public void setVrsFirstUrl(String vrsFirstUrl) {
        this.vrsFirstUrl = vrsFirstUrl;
    }

    public String getProgramTag() {
        return programTag;
    }

    public void setProgramTag(String programTag) {
        this.programTag = programTag;
    }
}
